package com.tiancheng.trade.commom.web.utils;

import org.apache.commons.codec.digest.DigestUtils;

import java.util.Arrays;
import java.util.Set;
import java.util.TreeSet;

/**
 * 签名工具类
 */
public class SignatureUtils {
    /**
     * 签名
     */
    public static String sha256Hex(String... param) {
        Set<String> signatureVar = new TreeSet<>(Arrays.asList(param));
        StringBuilder signatureStr = new StringBuilder();
        for (String key : signatureVar) {
            signatureStr.append(key);
        }
        return DigestUtils.sha256Hex(signatureStr.toString());
    }

}
